<template>
  <div v-if="!isEmpty(data)" class="box">
    <template v-for="item in data" :key="item.id">
      <component :is="componentsList[item.code]" :data="item"></component>
    </template>
  </div>
</template>
<script setup lang="ts">
import { onBeforeMount, shallowRef, ref } from "vue";
import { isEmpty } from "lodash";
import _ from "lodash";
import Button from "../../src/components/Button/index.vue";
import Input from "../../src/components/Input/index.vue";

const componentsList = {
  button: Button,
  input: Input,
};
const data = shallowRef<any>({});
onBeforeMount(() => {
  // 接收客户端posemessage传递过来的消息
  const obj = JSON.parse(localStorage.getItem("lowcode") || "");
  console.log("数据哈哈哈", obj);
  data.value = obj;
});
</script>
<style lang="scss" scoped>
.box {
  width: 1000px;
  height: 600px;
  overflow: hidden;
}
</style>
